#include <stdio.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        //子进程
        printf("i am child process\n");
        sleep(5);
        exit(1);
    }
    //父进程
    int status = 0;
    //阻塞等待
    pid_t ret = waitpid(id, &status, 0);
    assert(ret != -1);
    printf("子进程 > exit code: %d , sig: %d\n",(status >> 8) & 0X7F, status & 0XFF);
    return 0;
}
